<form method="post" id="frmEducation" name="frmEducation" action="{$smarty.const.HOST_VFRIEND}account/basicsave" enctype="multipart/form-data">
	<input type="hidden" name="ptsave" id="ptsave" value="{$intType}" />
	<div class="editForm">    	
        <div class="userInput">
        	<label>Trình độ học vấn:</label>
            <div class="pEducation">
                <select class="select" id="peducation" name="peducation" {if $objUser->education == 0}title="Chọn"{/if} onchange="showOther(this.value)">
                	<option value="">Chọn</option>
                    {if isset($smarty.session.st_education) && $smarty.session.st_education == -1}
                    	{html_options options=$arrEducation}                        
                        <option value="-1" selected="selected">Khác</option>
                    {else}
                		{html_options options=$arrEducation selected=$objUser->education}
                        <option value="-1">Khác</option>
                    {/if}
                </select>                
           	</div>
            <div class="secOther" {if isset($smarty.session.st_education) && $smarty.session.st_education == -1}style=""{else}style="display:none;"{/if}>
            	<input type="text" name="peducation_other" id="peducation_other" maxlength="150" value="{if isset($smarty.session.st_education_other)}{$smarty.session.st_education_other|escape}{/if}" class="text clearIt tMargin10" />
            </div>
        </div>
        <div class="userInput">
        	<input type="submit" value="Thay đổi" class="btnSubmit" />
            <input type="button" value="Hủy" class="btnCancel" onclick="javascript:basicClose('{$strView}','{$strEdit}')" />
        </div>
    </div>
</form>
<script type="text/javascript" language="javascript" src="{$smarty.const.HOST_STATICS}js/library/init.js"></script>
{literal}
<script type="text/javascript" language="javascript">
	$(document).ready(function(){		
		showOther = function(intValue) {
			if(intValue == -1) {
				$(".secOther").show();
			}
			else {
				$(".secOther").hide();
			}
		}	
		$("#frmEducation").validate({							
			errorClass		: "errorMessage",
			errorElement	: "span",
			onfocusout		: false,
			onkeyup			: false,
			rules: {	
				peducation:{
					required	: true,
					min			: 1
				},
				peducation_other: {
					otherRequired	: true,
					otherMinlength	: true
				}
				
			},
			messages: {	
				peducation:{
					required	: education_required,
					min			: education_required
				},
				peducation_other: {
					otherRequired	: education_other_required,
					otherMinlength	: education_other_minlength
				}
			},		
			errorPlacement: function(label, element) {			
				var id = element.attr("id");			
				label.insertAfter($("#" + id));			
			},
			submitHandler: function(form) {				
				form.submit();
			}
		});	
		$.validator.addMethod("otherRequired",function(){
			var education = $("#peducation").val();
			if(education == -1) {
				var educationOther = $("peducation_other").val();
				if(educationOther == "") {
					return false;
				}
			}
			return true;
		});	
		$.validator.addMethod("otherMinlength",function(){
			var education = $("#peducation").val();
			if(education == -1) {
				var educationOther = $("peducation_other").val();
				if(educationOther != "" && educationOther.length < 5 ) {
					return false;
				}
			}
			return true;
		});		
		$.validator.addMethod("passwordValidate", function(){
			var result 			= true;
			var strPassword		= $("#ppassword").val();
			var strHasPassword	= MD5(MD5(strGeneralCode) + MD5(strPassword));				
			var strUrl 			= HOST_VFRIEND + "valid/isvalidpassword";
			$("#ppassword").val("");
			$("#phascode").val(strHasPassword);
			$.ajax({
				cache	: false,
				async	: false,
				type	: "POST",
				data	: "password=" + strHasPassword,
				url		: strUrl,
				success	: function(response) {
					result = (response == 1) ? true : false;
				}
			});
			return result;								   
		});		
	});
</script>
{/literal}